//
//  HttpRequest.h
//  SmallDemo
//
//  Created by dj on 14-8-5.
//  Copyright (c) 2014年 dj. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "YMRequestFailureModel.h"
@class DataParser;

#ifdef DEBUG

#define OUTPUTLOG 1
#else

/** release 下 不要改 */
#define OUTPUTLOG 0
#endif

typedef void (^SucceedDictBlock)(BOOL isSuccess, NSDictionary *dict, YMRequestFailureModel *failureModel);
typedef void (^SucceedBlock)(BOOL isSuccess, id data, YMRequestFailureModel *failureModel);
typedef void (^FaildBlock)(YMRequestFailureModel *failureModel);
typedef void (^Progress)(float percentage);

@class HTTPRequest;

@interface HTTPRequest : NSObject
<NSURLConnectionDataDelegate>

@property (nonatomic, copy) SucceedBlock succeedBlock;
@property (nonatomic, copy) FaildBlock faildBlock;
@property (nonatomic, copy) NSString *urlStr;
@property (nonatomic, copy) NSURL *url;
@property (nonatomic, strong) NSMutableData *data;
@property (nonatomic, copy) NSString *parasString;
@property (nonatomic, copy) NSString *method;
@property (nonatomic, assign) BOOL showProgress;
@property (nonatomic, copy) Progress progress;

@property (nonatomic, assign) BOOL disableAutoShowErrorMessage;

@property (nonatomic, assign) BOOL readCache;//是否读取缓存 默认为No

//- (void)requestPostWithParams:(NSString *)params url:(NSString *)url method:(NSString *)method succeed:(SucceedBlock)succeed faild:(FaildBlock)faild;

- (void) requestGetDataParserWithUrl:(NSString *)url method:(NSString *)method succeed:(SucceedBlock)succeed faild:(FaildBlock)faild;

- (void)requestPostWithDataDict:(NSDictionary *)dict url:(NSString *)url method:(NSString *)method succeed:(SucceedBlock)succeed faild:(FaildBlock)faild;
- (void)requestPostRSAWithDataDict:(NSDictionary *)dict url:(NSString *)url method:(NSString *)method succeed:(SucceedBlock)succeed faild:(FaildBlock)faild;

@end
